﻿<!--
   Copyright 2011 Oren Nachman

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->
 <Window x:Class="AppLookup.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:AppLookup"
        Title="App Lookup" Height="175" Width="525"
        Closing="Window_Closing">
    
    <Window.Resources>

        <local:VisibilityBoolConverter x:Key="VisibilityBoolConverter"></local:VisibilityBoolConverter>

    </Window.Resources>

    <Grid>

        <Grid.RowDefinitions>
            <RowDefinition Height="30" />
            <RowDefinition Height="50" />
            <RowDefinition Height="253*" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="50*"></ColumnDefinition>
            <ColumnDefinition Width="100"></ColumnDefinition>
        </Grid.ColumnDefinitions>

        <TextBlock Margin="12,12,0,0">Enter a GUID, or an app URI:</TextBlock>
        
        <TextBox x:Name="txtGuid" Margin="12,0,12,12" Height="22" TextChanged="txtGuid_TextChanged" Grid.Row="1" Grid.Column="0"></TextBox>
        <Button x:Name="btnLookup" Content="Lookup" Height="22" Click="btnLookup_Click" Grid.Column="1" Grid.Row="1" Margin="0,0,12,12" IsDefault="True" IsEnabled="False"></Button>

        <StackPanel Grid.Row="2" Margin="12">
            <ProgressBar IsIndeterminate="True" Grid.Row="1" Height="20" Visibility="{Binding IsWorking, Converter={StaticResource VisibilityBoolConverter}}" Margin="0,-30,0,0"></ProgressBar>

            <TextBlock Margin="0,-20,0,0" Visibility="{Binding IsKnown, Converter={StaticResource VisibilityBoolConverter}}" Background="Transparent">
                <Hyperlink NavigateUri="{Binding AppUri}" RequestNavigate="Hyperlink_RequestNavigate" Background="Transparent">
                    <TextBlock x:Name="txtAppName"  FontSize="30" Text="{Binding AppName}" TextWrapping="Wrap" Background="Transparent"/>
                </Hyperlink>
            </TextBlock>

            <TextBlock x:Name="txtUnknown" Visibility="{Binding IsKnown, Converter={StaticResource VisibilityBoolConverter}, ConverterParameter='True'}" Foreground="Red" Background="Transparent" FontSize="30" Margin="0,-20,0,0" Text="{Binding Error}"></TextBlock>

        </StackPanel>

    </Grid>
</Window>
